package com.fenqing.utils;

/**
 * @author fenqing
 */
@FunctionalInterface
public interface Encoder<T, R> {

    @SuppressWarnings("all")
    static <T, R> Encoder<T, R> defaultEncoder() {
        return item -> (R) item;
    }

    /**
     * 将对象转换为json字符串
     *
     * @param input 输入对象
     * @return json字符串
     */
    R encoder(T input);

}